home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmBezier
- Caption = "Close me to stop the madness!"
- ClientHeight = 4605
- ClientLeft = 1095
- ClientTop = 1485
- ClientWidth = 8340
- DrawWidth = 3
- ForeColor = &H000000FF&
- Height = 5010
- Left = 1035
- LinkTopic = "Form1"
- ScaleHeight = 307
- ScaleMode = 3 'Pixel
- ScaleWidth = 556
- Top = 1140
- Width = 8460
- Option Explicit
- Declare Function Declare32 Lib "call32.dll" (ByVal Func As String, ByVal Library As String, ByVal Args As String) As Long
- Declare Sub FreeCall32IDs Lib "call32.dll" ()
- Declare Function GetDC Lib "call32.dll" Alias "Call32" (ByVal hwnd As Long, ByVal id As Long) As Long
- Declare Function ReleaseDC Lib "call32.dll" Alias "Call32" (ByVal hwnd As Long, ByVal hdc As Long, ByVal id As Long) As Long
- Declare Function PolyBezier Lib "call32.dll" Alias "Call32" (ByVal hdc As Long, points As tagPoint, ByVal count As Long, ByVal id As Long) As Long
- Declare Function GetDesktopWindow Lib "call32.dll" Alias "Call32" (ByVal id As Long) As Long
- Declare Function CreatePen Lib "call32.dll" Alias "call32" (ByVal style As Long, ByVal w As Long, ByVal c As Long, ByVal id As Long) As Long
- Declare Function SelectObject Lib "call32.dll" Alias "call32" (ByVal hdc As Long, ByVal hpen As Long, ByVal id As Long) As Long
- Declare Function DeleteObject Lib "call32.dll" Alias "call32" (ByVal hpen As Long, ByVal id As Long) As Long
- Dim idGetDC As Long
- Dim idReleaseDC As Long
- Dim idPolyBezier As Long
- Dim idCreatePen As Long
- Dim idSelectObject As Long
- Dim sw As Long, sh As Long
- Dim idDeleteObject As Long
- Dim h As Long, dc As Long
- Dim points() As tagPoint
- Const PointCount = 4
- Const PS_SOLID = 0
- Sub Form_Load ()
- Dim i As Integer, r As Long, hpen As Long
- idGetDC = Declare32("GetDC", "user32", "w")
- idReleaseDC = Declare32("ReleaseDC", "user32", "wi")
- idPolyBezier = Declare32("PolyBezier", "gdi32", "ipi")
- idCreatePen = Declare32("CreatePen", "gdi32", "iii")
- idSelectObject = Declare32("SelectObject", "gdi32", "ii")
- idDeleteObject = Declare32("DeleteObject", "gdi32", "i")
- Show
- dc = GetDC(hwnd, idGetDC)
- ReDim points(PointCount)
- While True
- hpen = CreatePen(PS_SOLID, 5, Rnd * &H1000000, idCreatePen)
- For i = 1 To PointCount
- points(i).x = Rnd * sw
- points(i).y = Rnd * sh
- Next i
- r = SelectObject(dc, hpen, idSelectObject)
- r = PolyBezier(dc, points(1), PointCount, idPolyBezier)
- r = DeleteObject(hpen, idDeleteObject)
- DoEvents
- Wend
- End Sub
- Sub Form_Resize ()
- sw = ScaleWidth
- sh = ScaleHeight
- Refresh
- End Sub
- Sub Form_Unload (Cancel As Integer)
- Dim r As Long
- r = ReleaseDC(hwnd, dc, idReleaseDC)
- ' make sure to call this to free the libraries that were loaded by
- ' Call32.dll - RAL
- Call FreeCall32IDs
- End
- End Sub
-